Skip to content

fix: resolve soft assertions for Cucumber steps (#14573)#1994

Merged
christian-bromann merged 2 commits intowebdriverio:mainfrom
mccmrunal:fix/soft-assertions-cucumber-14573
Jan 17, 2026
Merged

fix: resolve soft assertions for Cucumber steps (#14573)#1994
christian-bromann merged 2 commits intowebdriverio:mainfrom
mccmrunal:fix/soft-assertions-cucumber-14573

Conversation

@mccmrunal
Copy link
Copy Markdown
Contributor

WebdriverIO's expect.soft() was failing immediately in Cucumber steps instead of collecting failures and reporting them at the end. The root cause was in expect-webdriverio's
softAssert.ts

addFailure()
method threw immediately when no test context was set (which happened because Cucumber's beforeStep hook wasn't reliably setting context).

The fix introduces a GLOBAL_TEST_ID fallback. Instead of throwing an error when the context is missing, the service now stores the failure under a global bucket. This ensures that:

Execution continues even if the framework context is lost.
Failures are still collected and can be reported at the end of the step/scenario via the afterStep or afterScenario hooks.

Copy link
Copy Markdown
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/softAssert.ts Outdated
@christian-bromann christian-bromann merged commit 7ef0427 into webdriverio:main Jan 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants